#ifndef UNITTEST_H
#define UNITTEST_H
/**
 * Very simple, but very effective unit testing.
 *
 * @author Dejan Lekic <dejan.lekic@kcl.ac.uk>
 */

#include <iostream>

/**
 * Each module (class) should contain a static method named "unittest", which
 * should use this function to check if some constraint has been satisfied,
 * and give a descriptive (as much as possible) output.
 */
inline void doTest(const char* argName, ///< Name of the unit.
                   const unsigned short argNo, ///< ID of the test.
                   bool argCondition, ///< Condition that should be checked.
                   const char* argMsg1, ///< Message in case test successfully passed.
                   const char* argMsg2 ///< Message in case test failed.
                  ) {
  if (argCondition) {
    std::cout << argName
              << ".test"
              << argNo
              << " PASSED Result> "
              << argMsg1
              << std::endl;
  } else {
    std::cout << argName
              << ".test"
              << argNo
              << " FAILED Result> "
              << argMsg2
              << std::endl;
  } // else
} // doTest() function

// $Id: unittest.h 24 2009-04-21 12:04:25Z dejan.lekic $

#endif // UNITTEST_H
